<template>
  <div>
    <h2>ls</h2>

    <button @click="cut(0)">点击按钮删除数组中的数据</button>
    <p>{{ arrLength }}</p>
    <ul>
      <li v-for="item in arr" :key="item">{{ item }}</li>
    </ul>
  </div>
</template>

<script>
import { mapState, mapGetters, mapActions } from 'vuex'
export default {
  computed: {
    // map系列函数第一个参数的值由创建store中modules的键决定
    ...mapState('ls', ['arr']),
    ...mapGetters('ls', ['arrLength']),
  },
  methods: {
    ...mapActions('ls', ['cut']),
  },
}
</script>

<style></style>
